from wsgiref.simple_server import make_server
from purest.web.tools import autoreloader

def run(application, port=8000):

    def start_server(application, port):
        print("Serving on port {}...".format(port))
        httpd = make_server('', port, application)
        httpd.serve_forever()

    #autoreloader.main(start_server, args=(application, port))
    autoreloader.main(lambda: start_server(application, port))
